'''
Created on 21 dec. 2011

@author: Daan Timmer
'''

from CarList import CarList
from random import randint

class obj(object):
    def __init__(self, a, b):
        self.a = a
        self.b = b
        
    def __repr__(self):
        return "%s" % self.b

if __name__ == '__main__':
    cl = CarList()
    
    c = 10000

    for x in range(c):
        cl.AddTail(obj('', x * 2))
    
    
    for x in range(c / 2):
        random = randint(0, cl.Count() - 1)
        
        cl.Remove(cl.GetList()[random])
    
    
    tc = 0
    fc = 0
    
    size = 5
    
    for x in range(c * 10):
        location = randint(0, c)
        
        
        l, m, h, b = cl.SearchNearby(location, size)
        
        if b:
            tc += 1
        else:
            fc += 1
#        if True == b:
#            print "%s (%s): l:%s m:%s h:%s" % (b, location, l, m, h)
    
    
    print "t:%s f:%s" % (tc, fc)

#    
#    print cl.GetList()
